﻿package mortal.game.view.task.drama
{
    import com.gengine.debug.*;
    import com.gengine.global.*;
    import com.gengine.resource.*;
    import com.mui.controls.*;
    import com.mui.core.*;
    import com.mui.utils.*;
    import flash.events.*;
    import mortal.game.events.*;
    import mortal.game.manager.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.mvc.core.*;

    public class TaskDramaJump extends View
    {
        private var _container:GSprite;
        private var _bmp2:GBitmap;

        public function TaskDramaJump()
        {
            super.layer = LayerManager.highestLayer;
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this.mouseEnabled = true;
            this.mouseChildren = true;
            this._container = UICompomentPool.getUICompoment(GSprite) as GSprite;
            this._container.graphics.beginFill(16777215, 0);
            this._container.graphics.drawRect(-30, -30, 240, 120);
            this._container.graphics.endFill();
            this._container.buttonMode = true;
            this.addChild(this._container);
            this._container.mouseChildren = true;
            this._container.mouseEnabled = true;
            this._bmp2 = UIFactory.gBitmap(null, 0, 0, this._container);
            LoaderHelp.addResCallBack(ResFileConst.dramaTalk, this.resGotHandler);
            this._container.configEventListener(MouseEvent.CLICK, this.jumpHandler);
            return;
        }// end function

        private function jumpHandler(event:MouseEvent) : void
        {
            Log.error("剧情，手动点击“跳过按钮”结束了剧情");
            Dispatcher.dispatchEvent(new DataEvent(EventName.Task_DramaStopAll));
            return;
        }// end function

        private function resGotHandler() : void
        {
            if (isDisposed)
            {
                return;
            }
            this._bmp2.bitmapData = GlobalClass.getBitmapData(ImagesConst.Darma_jump);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._container.dispose(param1);
            this._container = null;
            this._bmp2.dispose(param1);
            this._bmp2 = null;
            return;
        }// end function

        override public function show(param1:int = 0, param2:int = 0) : void
        {
            super.show(Global.stage.stageWidth - 200, Global.stage.stageHeight - 80);
            return;
        }// end function

    }
}
